package clone;

public class Student implements Cloneable{
    public String name;
    public int age;

    public String stuId;

    public Teacher tutor;

    public Student() {
    }

    public Student(String name, int age, String stuId, Teacher tutor) {
        this.name = name;
        this.age = age;
        this.stuId = stuId;
        this.tutor = tutor;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", stuId='" + stuId + '\'' +
                ", tutor=" + tutor +
                '}';
    }

    @Override
    protected Student clone() throws CloneNotSupportedException {
        Student stu = (Student) super.clone();
        stu.tutor = (Teacher) this.tutor.clone();
        return stu;
    }
}
